package com.acme.bankapp.service.bank;

import com.acme.bankapp.domain.bank.Client;
import com.acme.bankapp.service.bank.email.EmailService;

/**
 * Created by zurdan on 14.11.14.
 * E-mail: Zurdanium@gmail.com
 */
public class EmailNotificationListener implements ClientRegistrationListener {
    private final EmailService emailService;

    public EmailNotificationListener(final EmailService emailService) {
        this.emailService = emailService;
    }

    @Override
    public void onClientAdded(final Client client) {
        System.out.println("Notification email for client " + client.getSalutation() + " to be sent.");
        emailService.sendNotificationMail(client, "YOLOmail@mail.com");
    }
}
